package com.example.book_system.controller;

import com.example.book_system.model.DbType;
import com.example.book_system.model.Student;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("yml")
public class ReadmylController {
    @Value("${server.port}")
    private Integer port;

    @Value("${mykey}")
    private String key;
    @Autowired
    private Student student;
    @Autowired
    private DbType dbType;

    @RequestMapping("/readyml")
    public String readmyl(){
        return "从yml中获取配置文件:"+port;
    }

    @RequestMapping("/mykey")
    public String mykey(){
        return "从yml中获取配置文件:"+key;
    }
    @RequestMapping("/readstudent")
    public String readstudent(){
        return "从yml中获取配置文件Student:"+student;
    }

    @RequestMapping("/readDbtype")
    public String readDbtype(){
        return "从yml中获取配置文件Student:"+dbType;
    }
}
